<link href="/css/bootstrap.min.css" rel="stylesheet"/>  
<link href="/templates/admin/css/admin_default.css" rel="stylesheet"/> 
<script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
<?php if($this->error){ ?>
	<div class="notification error" >
		<span class="strong">Error:</span>
		<?php echo $this->error; ?>.
		<span class="close" title="Dismiss"></span>
	</div>
<?php }?>
<?php if($this->warning){ ?>
	<div class="notification warning" >
		<span class="strong">Warning:</span>
		<?php echo $this->warning; ?>
		<span class="close" title="Dismiss"></span>
	</div>
<?php }?>
<?php $data=$this->data; foreach($data as $item){;?> 

<form name="editor" action="/admin/ads/doneedit" method="post" enctype="application/x-www-form-urlencoded">     
<div class="content">
    <input type="text" value="<?php echo $item['id'];?>"  name='id' style='display:none'/>
    <input type="text" value="<?php echo $item['page'];?>"  name='old_page' style='display:none'/>
    <input type="text" value="<?php echo $item['position'];?>"  name='old_pos' style='display:none'/>
    <input type="text" value="<?php echo $item['sort'];?>"  name='old_sort' style='display:none'/>
</div>
<div id="main-content">
    <div class="news-content">
        <label>Lựa chọn Trang hiển thị:</label>
            <div>
                <select name="select-page" id="select-page">
                    <option value="home" <?php if($item['page'] == 'home')echo "selected";?>>Trang chủ</option>
                    <option value="category1" <?php if($item['page'] == 'category1')echo "selected";?>>Trang thể loại</option>
                    <option value="category2" <?php if($item['page'] == 'category2')echo "selected";?>>Trang thể loại con</option>
                    <option value="detail" <?php if($item['page'] == 'detail')echo "selected";?>>Trang chi tiết</option>
                </select>
            </div>
    </div>
    
    <div class="news-content">
        <label>Lựa chọn Vị trí:</label>
            <div>
                <select name="select-pos" id="select-pos">
                    <option value="right" <?php if($item['position'] == 'right')echo "selected";?>>Cột bên phải</option>
                    <option value="top" <?php if($item['position'] == 'top')echo "selected";?>>Top - Dưới header trang</option>
                    <option value="bottom" <?php if($item['position'] == 'bottom')echo "selected";?>>Chân trang</option>
                </select>
            </div>
    </div>
    
    <div class="news-content">
        <label>Thứ tự hiển thị:</label>
            <div>
                <select name="select-sort" id="select-sort">
                    <option value="first">Trên cùng</option>
                    <option value="end">Dưới cùng</option>
                    <option value="option" selected="selected">Tùy chọn</option>
                </select>
            </div>
            <input style="display: block" type="text" value="<?php echo $item['sort'] ?>" placeholder="Vị trí (số thứ tự VD:2,3...)" id="sort" name="sort"/>
    </div>
    <script>
        $('#select-sort').change(function(){
            var sort = 'top';
            $('#select-sort option:selected').each(function(){
                sort = $(this).val();
                if(sort == 'option'){
                    $('#sort').css('display','block');
                }else{
                    $('#sort').css('display','none');
                }
            })
        })
    </script>
    <div class="news-content">
        <label>Chọn ảnh:</label>
        <input type="text" value="<?php echo $item['pictures'];?>" id="urlSelectImg" name="urlSelectImg" style="display: none;" />
        <input type="button" value="Upload" id="btnSelectImg" name="btnSelectImg" class="btn btn-success" />
        <div id="displayImages"><img max-height=100 max-width=100 class='images' src="<?php echo $item['pictures'];?>"/></div>
    </div>
    
    <div class="news-content">
        <label>Liên kết:</label>
        <textarea name="link"><?php echo $item['link'] ?></textarea>
    </div>
    
    <div class="news-content">
        <label>Mô tả:</label>
        <textarea name="description"><?php echo $item['description'] ?></textarea>
    </div>
    
    <div class="news-content">
        <label>Trạng thái:</label>
          <div>
            <select name="status">
                <option value="1" >ON</option>
                <option value="0" >OFF</option>
            </select>
          </div>
    </div>
    
    <div class="news-content">
        <label></label>
        <div>
            <input type="submit" value="Ðăng bài" class="btn btn-success"/>
        </div>
    </div>
    
</div>
</form>
<?php }?>